﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using BCService.AMap;
using Microsoft.AspNetCore.Mvc;

// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace BCTMSRESTful.Controllers.Management.Common.Area
{
    [ApiExplorerSettings(GroupName = "Admin")]
    [Route("api/v1/sim/[controller]")]
    public class AreaController : ManagementBaseController
    {
        private readonly IAddressCodeInfoSynchronizeService addressCodeInfoSynchronizeService;

        public AreaController(IAddressCodeInfoSynchronizeService addressCodeInfoSynchronizeService)
        {
            this.addressCodeInfoSynchronizeService = addressCodeInfoSynchronizeService;
        }

        #region 高德国家地址编码信息同步
        /// <summary>
        ///  高德国家地址编码信息同步
        /// </summary>
        /// <response code="204">高德国家地址编码信息同步成功</response>
        /// <response code="400">请求参数或输入的数据不正确。</response>
        /// <response code="500">服务器发生错误。</response>
        /// <response code="501">某些功能尚未实现。</response>
        /// <returns></returns>
        [HttpGet("[action]")]
        [ProducesResponseType(typeof(NoContentResult), 204)]
        public IActionResult SyncAddressCode()
        {
            addressCodeInfoSynchronizeService.Sync(this.Admin);
            return StatusCode((int)HttpStatusCode.NoContent);
        }
        #endregion
    }
}
